#include <bits/stdc++.h>
using namespace std;

using llt = long long;
using pii = pair<int, int>;
using pll = pair<llt, llt>;

template<typename T>
istream & operator >> (istream & is, vector<T> & vec) {
    for(auto & i : vec) is >> i;
    return is;
}

template<typename T>
void input(vector<T> & vec, int n){
    vec.assign(n + 1, {});
    for(int i=1;i<=n;++i) cin >> vec[i];
    return;
}


int N, M;
vector<llt> A, B;

void work(){
    cin >> N >> M;
    input(A, N); input(B, M);

    sort(A.begin() + 1, A.end());
    sort(B.begin() + 1, B.end());

    llt ans = 0;
    int k = 1;
    for(int i=1;i<=M;++i){
        const auto need = B[i];
        while(k <= N and A[k] < need) k += 1;
        if(k == N + 1){
            cout << "-1\n";
            return;
        }

        ans += A[k++];
    }
    cout << ans << "\n";
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}
